﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace APPFrameworkStudy.Domain.Mapping
{
    public class ProductMapping : BaseDomainMapping<Product>
    {
        public override void Init()
        {
            this.ToTable("Products");
            this.HasKey(l => l.ID);
            this.Property(l => l.Name).HasMaxLength(100).IsRequired();
            //映射Orders表和products表的主外键关系
            this.HasRequired(p => p.Order).WithMany(o => o.OrderItems).Map(o => o.MapKey("OrderID"));
        }
    }
}
